class Solution(object):
    def uniquePathsWithObstacles(self, obstacleGrid):
        """
        :type obstacleGrid: List[List[int]]
        :rtype: int
        """
        m = len(obstacleGrid)
        n = len(obstacleGrid[0])
        steps = [[0 for _ in range(n)] for _ in range(m)]
        if obstacleGrid[0][0] != 1:
            steps[0][0] = 1
        for i in range(m):
            for j in range(n):
                if obstacleGrid[i][j] == 1:
                    steps[i][j] = 0
                else:
                    if i - 1 >= 0:
                        steps[i][j] += steps[i - 1][j]
                    if j - 1 >= 0:
                        steps[i][j] += steps[i][j - 1]
        return steps[m - 1][n - 1]


data = Solution()
obstacleGrid = [[0,1],[0,0]]
print(data.uniquePathsWithObstacles(obstacleGrid))
